package com.gxjtkyy.datadistributer.writer.rdbms.vo;

import java.util.Arrays;

public class DbOperation {
   private final String sql;
   private final Object[] args;
   private final boolean insertable;
   private final boolean updatable;
   private final boolean dropWhenValueTooLarge;
   private final boolean dropWhenCannotInsertNull;
   private final boolean dropWhenValueLargeThanSpecifiedPrecision;

   private DbOperation(final String sql, final Object[] args, final boolean insertable, final boolean updatable, final boolean dropWhenValueTooLarge, final boolean dropWhenCannotInsertNull, final boolean dropWhenValueLargeThanSpecifiedPrecision) {
      this.sql = sql;
      this.args = args;
      this.insertable = insertable;
      this.updatable = updatable;
      this.dropWhenValueTooLarge = dropWhenValueTooLarge;
      this.dropWhenCannotInsertNull = dropWhenCannotInsertNull;
      this.dropWhenValueLargeThanSpecifiedPrecision = dropWhenValueLargeThanSpecifiedPrecision;
   }

   public static DbOperation of(final String sql, final Object[] args, final boolean insertable, final boolean updatable, final boolean dropWhenValueTooLarge, final boolean dropWhenCannotInsertNull, final boolean dropWhenValueLargeThanSpecifiedPrecision) {
      return new DbOperation(sql, args, insertable, updatable, dropWhenValueTooLarge, dropWhenCannotInsertNull, dropWhenValueLargeThanSpecifiedPrecision);
   }

   public String getSql() {
      return this.sql;
   }

   public Object[] getArgs() {
      return this.args;
   }

   public boolean isInsertable() {
      return this.insertable;
   }

   public boolean isUpdatable() {
      return this.updatable;
   }

   public boolean isDropWhenValueTooLarge() {
      return this.dropWhenValueTooLarge;
   }

   public boolean isDropWhenCannotInsertNull() {
      return this.dropWhenCannotInsertNull;
   }

   public boolean isDropWhenValueLargeThanSpecifiedPrecision() {
      return this.dropWhenValueLargeThanSpecifiedPrecision;
   }

   public boolean equals(final Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof DbOperation)) {
         return false;
      } else {
         DbOperation other = (DbOperation)o;
         if (!other.canEqual(this)) {
            return false;
         } else if (this.isInsertable() != other.isInsertable()) {
            return false;
         } else if (this.isUpdatable() != other.isUpdatable()) {
            return false;
         } else if (this.isDropWhenValueTooLarge() != other.isDropWhenValueTooLarge()) {
            return false;
         } else if (this.isDropWhenCannotInsertNull() != other.isDropWhenCannotInsertNull()) {
            return false;
         } else if (this.isDropWhenValueLargeThanSpecifiedPrecision() != other.isDropWhenValueLargeThanSpecifiedPrecision()) {
            return false;
         } else {
            Object this$sql = this.getSql();
            Object other$sql = other.getSql();
            if (this$sql == null) {
               if (other$sql != null) {
                  return false;
               }
            } else if (!this$sql.equals(other$sql)) {
               return false;
            }

            if (!Arrays.deepEquals(this.getArgs(), other.getArgs())) {
               return false;
            } else {
               return true;
            }
         }
      }
   }

   protected boolean canEqual(final Object other) {
      return other instanceof DbOperation;
   }

   public int hashCode() {
//      int PRIME = true;
      int result = 1;
      result = result * 59 + (this.isInsertable() ? 79 : 97);
      result = result * 59 + (this.isUpdatable() ? 79 : 97);
      result = result * 59 + (this.isDropWhenValueTooLarge() ? 79 : 97);
      result = result * 59 + (this.isDropWhenCannotInsertNull() ? 79 : 97);
      result = result * 59 + (this.isDropWhenValueLargeThanSpecifiedPrecision() ? 79 : 97);
      Object $sql = this.getSql();
      result = result * 59 + ($sql == null ? 43 : $sql.hashCode());
      result = result * 59 + Arrays.deepHashCode(this.getArgs());
      return result;
   }

   public String toString() {
      String var10000 = this.getSql();
      return "DbOperation(sql=" + var10000 + ", args=" + Arrays.deepToString(this.getArgs()) + ", insertable=" + this.isInsertable() + ", updatable=" + this.isUpdatable() + ", dropWhenValueTooLarge=" + this.isDropWhenValueTooLarge() + ", dropWhenCannotInsertNull=" + this.isDropWhenCannotInsertNull() + ", dropWhenValueLargeThanSpecifiedPrecision=" + this.isDropWhenValueLargeThanSpecifiedPrecision() + ")";
   }
}
